//
//  WelcomeViewController.swift
//  微博
//
//  Created by 吴思达 on 16/3/11.
//  Copyright © 2016年 吴思达. All rights reserved.
//

import UIKit
import SnapKit

class WelcomeViewController: UIViewController {
    
    override func loadView() {
        view = backgroundImage
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.setUpUI()
    }

    private func setUpUI() {
        
        view.addSubview(iconImage)
        view.addSubview(welcomeLabel)
        iconImage.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(view.snp_centerX)
            make.bottom.equalTo(view.snp_bottom).offset(-180)
        }
        welcomeLabel.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(iconImage.snp_bottom).offset(16)
            make.centerX.equalTo(view.snp_centerX)
        }
    }
    
    private lazy var iconImage: UIImageView = UIImageView(image: UIImage(named: "avatar_default_big"))
    private lazy var backgroundImage: UIImageView = UIImageView(image: UIImage(named: "ad_background"))
    
    private lazy var welcomeLabel: UILabel = {
        let l = UILabel()
        l.text = (UserAccount.shareAccount.name ?? "") + "欢迎归来"
        l.font = UIFont.systemFontOfSize(16)
        l.textColor = UIColor.darkGrayColor()
        l.sizeToFit()
        return l
    }()

  

}
